package reco.frame.demo.sample;

import reco.frame.demo.R;


import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.zxing.WriterException;
import com.zxing.encoding.EncodingHandler;
public class FragmentC extends Fragment {

	private ImageView mIv_qrcode;
	private TextView mTv_versionname;
	private boolean isLogin = true;
	private LinearLayout mLayoutNoLogin;
	private ImageView mIv_isLoginIcon;
	private LinearLayout mLayoutIsLogin;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View parent = inflater.inflate(R.layout.frag_c, container, false);
	//	SharedPreferences isLogin = getContext().getSharedPreferences("isLogin", 1);
		mIv_qrcode = (ImageView) parent.findViewById(R.id.mine_iv_qrcode);
		mTv_versionname = (TextView) parent.findViewById(R.id.mine_tv_versionname);
		mIv_isLoginIcon = (ImageView) parent.findViewById(R.id.mine_iv_isLoginIcon);
		mLayoutIsLogin = (LinearLayout) parent.findViewById(R.id.mine_layout_isLogin);
		mLayoutNoLogin = (LinearLayout) parent.findViewById(R.id.mine_layout_noLogin);
		if (isLogin){

		}else {
			String imei = Settings.Secure.getString(getActivity().getContentResolver(),
					Settings.Secure.ANDROID_ID);
			//String imei = ((TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
			Log.i("test",imei);
			Bitmap bitmap = null;
			try {
				bitmap = EncodingHandler.createQRCode(imei, (int) getContext().getResources().getDimension(R.dimen.px300));
				mIv_qrcode.setImageBitmap(bitmap);
			} catch (WriterException e) {
				e.printStackTrace();
			}
		}


		return parent;
	}


}
